<template>
  <van-nav-bar
    @click-left="$router.push(path)"
    class="hmNanBar"
    @click-right="clickRight"
  >
    <template #left v-if="showLeft">
      <i class="iconfont f44">&#xe637;</i>
    </template>
    <template #title>
      <div class="title">
        {{ title }}
      </div>
    </template>
    <template #right>
      <div class="right">
        {{ right }}
      </div>
    </template>
  </van-nav-bar>
</template>

<script>
export default {
  name: 'hmNanBar',
  // 在子组件上定义一个属性名 props: ['title', 'path', 'right'],
  props: {
    title: {
      type: String,
      default: undefined
    },
    path: {
      type: String,
      default: undefined
    },
    right: {
      type: String,
      default: undefined
    },
    showLeft: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    clickRight () {
      this.$emit('rightClick')
    }
  }
}
</script>

<style lang="less">
.hmNanBar {
  .f44 {
    font-size: 44px;
  }
  ::v-deep .van-nav-bar__left,
  ::v-deep .van-nav-bar__right {
    padding: 0;
  }
  .title {
    font-size: 18px;
    font-family: PingFangSC, PingFangSC-Semibold;
    font-weight: 600;
    text-align: left;
    color: #222222;
    line-height: 25px;
    letter-spacing: 0px;
  }
  .right {
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: left;
    color: #181a39;
    line-height: 20px;
    letter-spacing: 0px;
  }
}
</style>
